public class AnimalTest2 {
    public static void main(String[] args) {
        System.out.println("-----------多态方法调用-----------");
        //向上转型
        Animal A = new Dog();
        A.eat();
        System.out.println("--------------------------------");
        Animal B = new Cat();
        B.eat();
        System.out.println("--------------------------------");
        //向下转型
        Dog dog = (Dog) A;
        ((Dog) A).lookDoor();
        A.eat();
        System.out.println("--------------------------------");
        Cat cat = (Cat) B;
        ((Cat) B).cathRat();
        B.eat();
    }
}
